home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj8307.arc / LISSAJOU.BAS < prev    next >
BASIC Source File  |  1980-01-01  |  2KB  |  46 lines

  1. 10 ' ************  GENERATION OF 3-D LISSAJOUS FIGURE STEREO PAIRS **********
  2. 15 '
  3. 20 '             (C) Scott Camazine and Westy Dain
  4. 25 '             adapted from BYTE, October, 1979
  5. 27 '
  6. 40 '  VARYING THE PARAMETERS A,B,C,Q,R,S,G GENERATES OTHER LISSAJOUS FIGURES
  7. 50 '
  8. 60 ' The following sets of parameters yield good figures:
  9. 62 '
  10. 63 '    A       B       C       Q       R       S       G
  11. 64 '  ------------------------------------------------------
  12. 65 '    4       2       8       8       3       5       0
  13. 66 '    4       2       8       2       3       5       0
  14. 67 '    4       2       8       2       3       7       0
  15. 68 '    4       2       8       2       3       0       1
  16. 70 '
  17. 110 KEY OFF : CLS: SCREEN 2
  18. 120 '
  19. 130 ' ***************** VARIABLES *******************************************
  20. 140 '
  21. 150 A=4: B=2.3: C=8: Q=4: R=2: S=0: T=3: G=1    ' LISSAJOUS EQUATION PARAMETERS
  22. 160 '
  23. 170 ' TRANSFORMATION EQUATION AND PLOTTING PARAMETERS
  24. 180 '
  25. 190   E = 1.25  'distance from the nose to the eye (inches)
  26. 200   F = 100   'scaling factor for the size of the figure
  27. 210  ZO = 6     'distance at which the stereo pairs are to be viewed (inches)
  28. 220   D = 30    'distance from eye to location of Lissajous figure in space
  29. 230 CXL = 75    'variable to position the image on the screen
  30. 233 CXR = 600
  31. 234  CY = 100
  32. 240 ' **************** GENERATE THE PAIRS OF FIGURES *************************
  33. 250 '
  34. 260 FOR W = 1 TO 8  STEP .01 'Smaller steps give a smoother picture
  35. 270     X = A*SIN(Q*W*T)     'general equation for lissajous figures in space
  36. 280     Y = B*SIN(R*W*T)
  37. 290     Z = C*SIN(S*W*T) + G*W*10
  38. 300     X1=((X-E)*ZO/(Z+D)+E)*F  ' equations which transform a point in
  39. 310     X2=((X+E)*ZO/(Z+D)-E)*F  ' space to points on the viewing plane
  40. 320     Y1=(Y*ZO/(Z+30))*F
  41. 330     PSET(X1+CXL,Y1+CY)
  42. 340     PSET(X2+CXR,Y1+CY)
  43. 350 NEXT W
  44. 360 END
  45. on the viewing plane
  46. 32